<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>检测是否为数组</title>
    <script>
        // 1. instanceof 运算符
        var arr = []
        var obj = {}
        console.log(arr instanceof Array);
        console.log(obj instanceof Array);

        // 2. H5新增的方法 IE9 以上支持
        console.log(Array.isArray(arr));
        console.log(Array.isArray(obj));
    </script>
</head>
<body>
    
</body>
</html>